<!DOCTYPE html>
<html lang="en">

<head>
    <#include "/jh/admin/components/meta.html" />
    <title>${(student.name)!}跟进记录 ${metaTitleSuffix!}</title>
    <#include "/jh/admin/components/stylesheets.html" />
</head>

<body>
    <div id="app">
        <el-container>
            <#assign menuIndex="2-1" />
            <#include "/jh/admin/components/menu.html" />
            <el-container>
                <#include "/jh/admin/components/header.html" />
                <el-main>
                    <template>
                        <div class="title">${(student.name)!}跟进记录</div>
                        <el-form ref="form" :model="info" label-width="100px">
                            <!-- <el-form-item label="跟进时间">
                                <el-date-picker v-model="info.date" type="datetime" placeholder="选择时间" value-format="yyyy-MM-dd HH:mm:ss">
                                </el-date-picker>
                            </el-form-item> -->
                            <el-form-item label="内容">
                                <el-input v-model="info.content" type="textarea" :rows="4" placeholder="请输入内容"></el-input>
                            </el-form-item>
                            <el-form-item label="预约时间">
                                <el-date-picker v-model="info.nextDate" type="datetime" placeholder="选择时间" value-format="yyyy-MM-dd HH:mm:ss">
                                </el-date-picker>
                            </el-form-item>
                            <el-form-item>
                                <el-button type="primary" @click="submit">提交</el-button>
                                <el-button @click="back">取消</el-button>
                            </el-form-item>
                        </el-form>
                    </template>
                </el-main>
            </el-container>
        </el-container>
        <#include "/jh/admin/components/footer.html" />
    </div>
    <#include "/jh/admin/components/scripts.html" />
    <script type="text/javascript">
    var vue = new Vue({
        el: '#app',
        data() {
            return {
                info: {}
            }
        },
        watch: {
        },
        mounted: function() {
        },
        methods: {
            submit() {
                var self = this;
                var map = {
                    date: self.info.date,
                    content: self.info.content,
                    nextDate: self.info.nextDate,
                    studentId: '${(student.id)!}'
                };
                if (self.info.id != null && self.info.id != '') {
                    map['followId'] = self.info.id;
                }
                var param = Qs.stringify(map);
                loading();
                axios({
                        url: '/jh/admin/studentFollow/submit',
                        method: 'post',
                        data: param,
                        headers: {
                            'Content-Type': 'application/x-www-form-urlencoded'
                        }
                    })
                    .then(function(response) {
                        if (response.data.status == 200) {
                            endLoading();
                            window.location.href = "/jh/admin/studentFollow?studentId=${(student.id)!}";
                            // msg("登录成功");
                        } else {
                            endLoading();
                            msg(response.data.msg);
                            console.log(response.data);
                        }
                    })
                    .catch(function(error) {
                        endLoading();
                        msg("提交失败");
                        console.log(error);
                    });
            },
            back() {
                window.history.back();
            }
        }
    })
    </script>
    <script>
        vue.info = ${info!'{}'};
    </script>
    <style type="text/css">
    .title {
        font-size: 18px;
        font-weight: bold;
        margin: 0 0 1rem 100px;
    }
    </style>
    <#include "/jh/admin/components/msg.html" />
</body>

</html>